import axios from '@/utils/request';

/**
 * 新增第三方公司档案
 */
export async function AddThirdcompany(params) {
    const res = await axios.post('/Thirdcompany/AddThirdcompany',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取第三方公司档案查询分页列表
 */
 export async function QueryThirdcompanyPageList(params) {
    const res = await axios.post('/Thirdcompany/QueryThirdcompanyPageList',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据id获取第三方公司档案
 */
 export async function GetThirdcompanyById(id) {
    const res = await axios.get('/Thirdcompany/GetModelById/'+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新第三方公司档案
 */
 export async function UpdateThirdcompany(params) {
    const res = await axios.post('/Thirdcompany/UpdateThirdcompany',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 删除第三方公司
 */
 export async function DeleteThirdcompany(id) {
    const res = await axios.post('/Thirdcompany/DeleteThirdcompany?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 获取所有第三方公司
 */
export async function GetAllThreedCompany() {
    const res = await axios.get('/Thirdcompany/GetAllThreedCompany/');
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


 /**
  * 修改第三方公司状态信息
  */
 export async function UpdateStatus(params) {
    const res = await axios.post('/Thirdcompany/UpdateStatus',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
  }